//一级路由
import Shouye from '../pages/homePage'
import Feidian from '../pages/boilingPoint'
import Huati from '../pages/topic'
import Huodong from '../pages/activity'
import Detail from '../pages/detail'
import Labelpage from '../pages/labelpage'

//二级路由
import Tui from '../pages/homePage/tui'
import Hou from '../pages/homePage/hou'
import Qian from '../pages/homePage/qian'
import Android from '../pages/homePage/android'
import Ios from '../pages/homePage/ios'
import Ren from '../pages/homePage/ren'
import Kai from '../pages/homePage/kai'
import Dai from '../pages/homePage/dai'
import Yue from '../pages/homePage/yue'
//标签管理
import Allpage from '../pages/labelpage/allpage'
import Newpage from '../pages/labelpage/newpage'
const routes = [
    {
      title: '首页',
      path: '/shouye',
      component: Shouye,
      children:[
        {
          title: '推荐',
          path:'/shouye',
          component:Tui
        },
        {
          title: '后端',
          path:'/shouye/hou',
          component:Hou,
        },
        {
          title: '前端',
          path:'/shouye/qian',
          component:Qian
        },
        {
          title: 'Android',
          path:'/shouye/android',
          component:Android,
        },
        {
          title: 'iOS',
          path:'/shouye/ios',
          component:Ios
        },
        {
          title: '人工智能',
          path:'/shouye/ren',
          component:Ren,
        },
        {
          title: '开发工具',
          path:'/shouye/kai',
          component:Kai
        },
        {
          title: '代码人生',
          path:'/shouye/dai',
          component:Dai,
        },
        {
          title: '阅读',
          path:'/shouye/yue',
          component:Yue,
        },
        
      ]
    },
    {
      title: '沸点',
      path: '/boilingPoint',
      component: Feidian
    },
    {
      title: '话题',
      path: '/topic',
      component:Huati,
    },
    {
      title: '小册',
      path: '/xiaoce',
      component: ()=>import('../pages/brochure').catch(err => err)
    },
    {
      title: '活动',
      path: '/activity',
      component:Huodong,
    },
    {
      path:'/detail',
      component:Detail,
    },
    {
      path:'/labelpage',
      component:Labelpage,
      children:[
        {
          title: '已关注标签',
          path:'/labelpage',
          component:Newpage
        },
        {
          title: '全部标签',
          path:'/labelpage/allpage',
          component:Allpage
        },
      ]
    },
    {
      path: '/',
      redirect: '/shouye'
    },
    
  ]
//生成一级头部数据
export function createHead(){
  return routes.filter(item=>item.title)
}
//首页下二级路由的title
export function twoTitle(){
  return routes[0].children.filter(item=>item.title)
}
//标签管理下二级路由的title
export function labelTitle(){
  return routes[6].children.filter(item=>item.title)
}







  export default routes
